/*
    DESC Array.from()从可迭代对象和类数组对象构造数组实例
*/
//1.从字符串构建数组
let str = "hello";
let arr1 = Array.from(str, (item) => item + "x");
console.log(arr1);

//常用，生成指定长度的数组，并根据下标进行处理
let arr2 = Array.from({ length: 5 }, (v, i) => i * 2);
console.log(arr2); //[ 0, 2, 4, 6, 8 ]

/*
    DESC Array.isArray()检测是否为Array类型
*/

let arr3 = [1, 2, 3];

console.log(Array.isArray(arr3)); //true

//typeof检测不精确
console.log(typeof arr3); //"object"

/*
    DESC Array.of()根据传入的元素构造数组
*/
//空数组 []
let example1 = Array.of();
console.log(example1);

//[1,2,3,4]
let example2 = Array.of(1, 2, 3, 4);
console.log(example2);
